package com.liuxu.topnews.acitivity;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;

import com.liuxu.topnews.BuildConfig;
import com.liuxu.topnews.R;

public class SplashActivity extends AppCompatActivity {

    private final int SPLASH_DISPLAY_LENGHT = 3000; // 两秒后进入系统

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        switch (BuildConfig.version){
            case "normal":
                setContentView(R.layout.activity_splash_normal);
                break;
            case "agent":
                setContentView(R.layout.activity_splash_agent);
                break;
            case "dream":
                setContentView(R.layout.activity_splash_agent);
                break;
            case "rich":
                setContentView(R.layout.activity_splash_rich);
                break;
            case "mc":
                setContentView(R.layout.activity_splash_mc);
                break;
            case "compass":
                setContentView(R.layout.activity_splash_compass);
                break;
            case "hw":
                setContentView(R.layout.activity_splash_hw);
                break;
            case "xm":
                setContentView(R.layout.activity_splash_xm);
                break;
            case "king":
                setContentView(R.layout.activity_splash_king);
                break;
            case "enews":
                setContentView(R.layout.activity_splash_enews);
                break;
            case "book":
                setContentView(R.layout.activity_splash_book);
                break;
            case "zero":
                setContentView(R.layout.activity_splash_zero);
                break;
            default:
                setContentView(R.layout.activity_splash_normal);
                break;
        }

        new android.os.Handler().postDelayed(new Runnable() {
            public void run() {
                Intent mainIntent = new Intent(SplashActivity.this,
                        MainActivity.class);
                SplashActivity.this.startActivity(mainIntent);
                SplashActivity.this.finish();
            }

        }, SPLASH_DISPLAY_LENGHT);

    }
}
